package leetcode.周赛.第274场;

import org.junit.Test;

import java.util.*;

/**
 * @author ：zsy
 * @date ：Created 2022/1/2 12:57
 * @description：https://leetcode-cn.com/problems/check-if-all-as-appears-before-all-bs/
 */
public class 检查是否所有A都在B之前 {
    @Test
    public void test() {
        Solution solution = new Solution();
    }


    class Solution {
        public boolean checkString(String s) {
            int countB = 0;
            for (char c : s.toCharArray()) {
                if (c == 'b') countB++;
                if (c == 'a' && countB > 0) return false;
            }
            return true;
        }
    }
}
